//
//  SYTongJiViewController.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/4/25.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYTongJiViewController.h"
#import "SYTongJiListView.h"
#import "SYKaoShiTongJiView.h"


@interface SYTongJiViewController ()
@property (strong, nonatomic) SYTopView *topView;
@property (strong, nonatomic) SYTongJiListView *tjView;//统计
@property (strong, nonatomic) SYKaoShiTongJiView *kaoView;//考试通几

@end

@implementation SYTongJiViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self initSubView];
    
    self.view.backgroundColor = [UIColor colorWithHexString:@"EEEEEE"];
}

- (void)initSubView {
    [self.view addSubview:self.topView];
    [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(45);
    }];
    //统计
    [self.view addSubview:self.tjView];
    __weak typeof(self) weakSelf = self;
    self.tjView.block = ^(id index) {
        //考试统计
        [weakSelf.view addSubview:weakSelf.kaoView];
        [weakSelf.kaoView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.top.equalTo(weakSelf.view);
        }];
        if (index !=nil) {
            [weakSelf.kaoView requestDataListModel:(SYExamInfoModel *)index];
        }
    };
    [self.tjView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topView.mas_bottom);
        make.left.right.bottom.equalTo(self.view);
    }];
    
    
}

- (void)viewDidSlidInto {
    [self.tjView rquestDataList];
}


- (SYTopView *)topView {
    if (!_topView) {
        _topView = [[SYTopView alloc] init];
        _topView.titleLab.text = @"考试列表";
        _topView.backgroundColor = [UIColor colorWithHexString:@"EEEEEE"];
    }
    return _topView;
}

- (SYTongJiListView *)tjView {
    if (!_tjView) {
        _tjView = [[SYTongJiListView alloc] init];
        _tjView.contentView = self.view;
    }
    return _tjView;
}

- (SYKaoShiTongJiView *)kaoView {
    if (!_kaoView) {
        _kaoView = [[SYKaoShiTongJiView alloc] init];
    }
    return _kaoView;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
